﻿using MongoDB.Driver;
using WQLWebAPI.Domain.Entities;
using WQLWebAPI.Infrastructure.CommonDtos;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace WQLWebAPI.Domain.Abstract
{
    public interface IBaseRepository<T> where T : Entity
    {
        IMongoDatabase Database { get; }
        IMongoCollection<T> Collection { get; }
        List<T> Get();

        Task<List<T>> GetAsync();
        List<T> Get(FilterDefinition<T> filter, PageInputDto pageInput);
        Task<Pagelist<T>> GetAsync(FilterDefinition<T> filter, PageInputByDateDto pageInput);
        Task<Pagelist<T>> GetAsync(FilterDefinition<T> filter, PageInputDto pageInput);

        Task<List<T>> GetAsync(Expression<Func<T, bool>> filter);
        Task<List<T>> GetAsync(FilterDefinition<T> filter);

        Task<List<T>> GetAsync(Expression<Func<T, bool>> filter, FindOptions options = null);

        Task<T> FirstOrDefaultAsync(string id);
        Task<T> FirstOrDefaultAsync(Expression<Func<T, bool>> filter, FindOptions options = null);

        Task<bool> RemoveAsync(List<string> ids);

        Task<T> CreateAsync(T input);

        Task CreateManyAsync(IEnumerable<T> input);


        Task<bool> UpdateAsync(string id, T input);



        Task<bool> RemoveAsync(T input);


        Task<bool> RemoveAsync(string id);

    }
}
